﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace nzmq.tests
{
    [TestFixture]
    public class use_NzmqContext
    {
        [Test]
        public void Create_context_with_default_number_of_IO_threads()
        {
            using(var ctx = new NzmqContext())
            {}
        }


        [Test]
        public void Create_context_with_specific_number_of_IO_threads()
        {
            using (var ctx = new NzmqContext(0))
            {}
        }


        [Test]
        public void Create_service_socket()
        {
            using(var ctx = new NzmqContext())
            using(var sck = ctx.CreateServiceSocket("inproc://service"))
            {
                Assert.IsNotNull(sck);
            }
        }


        [Test]
        public void Create_client_socket()
        {
            using (var ctx = new NzmqContext())
            using (ctx.CreateServiceSocket("inproc://service"))
            using (var sck = ctx.CreateClientSocket("inproc://service"))
            {
                Assert.IsNotNull(sck);
            }
        }


        [Test]
        public void Create_pub_sub_sockets()
        {
            using (var ctx = new NzmqContext())
            using (var psck = ctx.CreatePublisherSocket("inproc://pub"))
            using (var ssck = ctx.CreateSubscriberSocket("inproc://pub"))
            {
                Assert.IsNotNull(psck);
                Assert.IsNotNull(ssck);
            }
        }
    }
}
